﻿<UserControl x:Class="Mnk.TBox.Plugins.AppConfigManager.Settings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:loc="clr-namespace:Mnk.TBox.Plugins.AppConfigManager.Code.Localization"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Units="clr-namespace:Mnk.Library.WpfControls.Components.Units;assembly=Mnk.Library.WPFControls"
             xmlns:Code="clr-namespace:Mnk.TBox.Plugins.AppConfigManager.Code" xmlns:AppConfigManager="clr-namespace:Mnk.TBox.Plugins.AppConfigManager"
             xmlns:components="clr-namespace:Mnk.Library.WpfControls.Components;assembly=Mnk.Library.WPFControls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" >
    <DockPanel >
        <GroupBox Header="{loc:Tr Profile}" DockPanel.Dock="Top">
            <Units:ComboBoxUnit Name="Profile" ValueCaption="{Binding SelectedProfile}" ItemsSource="{Binding Profiles}" UnitType="Text" Title="{loc:Tr Profile}" />
        </GroupBox>
        <TabControl IsEnabled="{Binding ElementName=Profile,Path=IsSelected}" DataContext="{Binding ElementName=Profile, Path=SelectedValue}">
            <TabItem Header="{loc:Tr ApplicationSettingsToSet}">
                <DockPanel>
                    <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right" >
                        <Button Content="{loc:Tr FillOptionsFromTemplate}" Click="BuildClick"/>
                    </StackPanel>
                    <Units:CheckableListBoxUnit Name="Options" ItemsSource="{Binding Options}" UnitType="Text" Title="{loc:Tr Option}">
                        <Units:CheckableListBoxUnit.ItemTemplate>
                            <DataTemplate DataType="{x:Type Code:Option}">
                                <DockPanel>
                                    <components:ExtCheckBox IsChecked="{Binding IsChecked}" VerticalAlignment="Center" DockPanel.Dock="Left" Padding="5,0" ValueChanged="CheckBox_Checked" />
                                    <TextBlock Text="{Binding Key}" Padding="1" TextTrimming="CharacterEllipsis" DockPanel.Dock="Left" Width="256"/>
                                    <components:AutoComboBox Text="{Binding Value}" IsEditable="True" Padding="0" IsEnabled="{Binding IsChecked}"
                                              ItemsSource="{Binding KnownAttributesValues, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type AppConfigManager:Settings}}}" />
                                </DockPanel>
                            </DataTemplate>
                        </Units:CheckableListBoxUnit.ItemTemplate>
                    </Units:CheckableListBoxUnit>
                </DockPanel>
            </TabItem>
            <TabItem Header="{loc:Tr ConfigurationFiles}">
                <Units:CheckableFileListBoxUnit ItemsSource="{Binding Files}" UnitType="FilePath" Title="{loc:Tr Files}" PathGetterType="File" PathGetterFilter="{loc:Tr FileMasks}" />
            </TabItem>
        </TabControl>
    </DockPanel>
</UserControl>